package com.finance.system.user.exception;


import com.finance.system.support.exception.FinanceBusinessException;
import com.finance.system.user.constant.UserConstant;

public class AuthException extends FinanceBusinessException {

    AuthException() {
        super();
    }
    private AuthException(String code, String msg) {
        super(code, msg);
    }

    static class TokenNotExistException extends AuthException {
        private TokenNotExistException(String code, String msg) {
            super(code, msg);
        }
    }

    static class TokenExpiredException extends AuthException {
        private TokenExpiredException(String code, String msg) {
            super(code, msg);
        }
    }

    static class TokenInvalidException extends AuthException {
        private TokenInvalidException(String code, String msg) {
            super(code, msg);
        }
    }

    static class UserHasExistException extends AuthException {
        private UserHasExistException(String code, String msg) {
            super(code, msg);
        }
    }

    static class VerifyCodeErrorException extends AuthException {
        private VerifyCodeErrorException(String code, String msg) {
            super(code, msg);
        }
    }

    public static TokenNotExistException tokenNotExistException(){
        return new TokenNotExistException(UserConstant.TOKEN_NOT_EXIST,"无法获取token");
    }

    public static TokenExpiredException tokenExpiredException(){
        return new TokenExpiredException(UserConstant.TOKEN_IS_EXPIRED,"token 已过期");
    }

    public static TokenInvalidException tokenInvalidException(){
        return new TokenInvalidException(UserConstant.TOKEN_IS_INVALID,"token 无效");
    }

    public static UserHasExistException userHasExistException(){
        return new UserHasExistException(UserConstant.USER_HAS_EXIST,"用户已存在");
    }

    public static VerifyCodeErrorException verifyCodeErrorException(){
        return new VerifyCodeErrorException(UserConstant.VERIFY_CODE_ERROR,"用户已存在");
    }
}



